﻿using MediatR;
using System.WXT.Infrstructre.Interface;
using System.WXT.WebAPI.Application.Command.CraftCommand;

namespace System.WXT.WebAPI.Application.CommandHandlers.CraftCommandHandlers
{
    public class CraftDeleteCommandHandlers:IRequestHandler<CraftDeleteCommand,int>
    {
        protected readonly ICraftRepository craftRepository;

        public CraftDeleteCommandHandlers(ICraftRepository craftRepository)
        {
            this.craftRepository = craftRepository;
        }
        /// <summary>
        /// 工艺删除
        /// </summary>
        /// <param name="request"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        public async Task<int> Handle(CraftDeleteCommand request, CancellationToken cancellationToken)
        {
            var list = await craftRepository.GetBaby(request.craftManageId);
            list.craftManageIsDel = 1;
            return await craftRepository.Update(list);
        }
    }
}
